<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px" style="margin-bottom: 5px;font-size: 0px">
      <div class="con-container">
        <div class="lab-container">
            <label class="condition-item-title">系统名称</label>
            <el-form-item label="" prop="appName" class="custom-el-form-item">
                <el-input
                    v-model="queryParams.appName" class="query-param"
                    placeholder="请输入系统名称"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                />
            </el-form-item>
        </div>

        <div class="btn-container">
          <el-form-item>
            <el-button type="primary" icon="el-icon-setting" size="mini" @click="conditionToggle">高级查询
            </el-button>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
                       v-hasPermi="['place:ssoConfig:add']">新增
            </el-button>
            <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
                       v-hasPermi="['place:ssoConfig:export']">导出
            </el-button>
            <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
                    v-hasPermi="['place:ssoConfig:remove']"
            >删除</el-button>
          </el-form-item>
        </div>
      </div>

      <div class="toggle-container" ref="toggle-container" style="display: none;">

        <div class="condition-item">
            <label class="condition-item-title">系统ID</label>
              <el-form-item label="" prop="appId">
                <el-input
                  v-model="queryParams.appId" class="query-param"
                  placeholder="请输入系统ID"
                  clearable
                  size="small"
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
        </div>
        <div class="condition-item">
            <label class="condition-item-title">系统标识</label>
              <el-form-item label="" prop="appClient">
                <el-input
                  v-model="queryParams.appClient" class="query-param"
                  placeholder="请输入系统标识"
                  clearable
                  size="small"
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
        </div>
        <div class="condition-item">
            <label class="condition-item-title">是否展示</label>
              <el-form-item label="" prop="isShow">
                <el-select v-model="queryParams.isShow" size="small" class="query-param">
                  <el-option label="是" value="1" />
                  <el-option label="否" value="0" />
                </el-select>
              </el-form-item>
        </div>
      </div>
    </el-form>

    <el-table ref="table" v-loading="loading" @sort-change="changeTableSort" stripe @row-dblclick="handleDoubleClick"
              :height="tableHeight" :header-cell-style="{fontSize:'14px', fontWeight:'500'}"
              :data="ssoConfigList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" type="index" width="60" align="left">
          <template slot-scope="scope">
              <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
          </template>
      </el-table-column>
      <el-table-column label="系统名称" align="left" prop="appName" sortable :render-header="renderHeader"/>
      <el-table-column label="系统ID" align="left" prop="appId" sortable :render-header="renderHeader"/>
      <el-table-column label="系统标识" align="left" prop="appClient" sortable :render-header="renderHeader"/>
      <el-table-column label="单点跳转地址" align="left" prop="loginUrl" sortable :render-header="renderHeader"/>
      <el-table-column label="系统图标" align="left" prop="iconUrl" sortable :render-header="renderHeader"/>
      <el-table-column label="展示顺序" align="left" prop="showOrder" sortable :render-header="renderHeader"/>
      <el-table-column label="是否展示" align="left" prop="isShow" sortable :render-header="renderHeader">
        <template slot-scope="scope">
          <span v-if="scope.row.isShow == 1">是</span>
          <span v-else>否</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="180">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="handleView(scope.row)"
            v-hasPermi="['place:ssoConfig:query']"
          >详情</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['place:ssoConfig:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['place:ssoConfig:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      :page-sizes="pageList"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 新增或修改单点登录系统信息对话框 -->
    <el-dialog :visible.sync="open" :close-on-click-modal="false" class="customForm _baseForm_big" @opened="openDialog">
      <div slot="title">
        <span><i :class="dialogIcon"></i></span>
        <span> {{ title }}</span>
      </div>
      <div class="ssoConfig-body"></div>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
          <div class="sub-project">
              <div class="sub-title">
                  <div class="sub-title-name">基本信息</div>
              </div>
              <div class="sub-body">
                  <el-row>
        <el-col :span="12">
            <el-form-item label="系统名称" prop="appName" v-if="!readOnly">
              <el-input v-model="form.appName" placeholder="请输入系统名称" />
            </el-form-item>
            <el-form-item label="系统名称：" prop="appName" v-if="readOnly" class="custom-form-item">
                {{form.appName}}
            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="系统ID" prop="appId" v-if="!readOnly">
              <el-input v-model="form.appId" placeholder="请输入系统ID" />
            </el-form-item>
            <el-form-item label="系统ID：" prop="appId" v-if="readOnly" class="custom-form-item">
                {{form.appId}}
            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="系统标识" prop="appClient" v-if="!readOnly">
              <el-input v-model="form.appClient" placeholder="请输入系统标识" />
            </el-form-item>
            <el-form-item label="系统标识：" prop="appClient" v-if="readOnly" class="custom-form-item">
                {{form.appClient}}
            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="系统密钥" prop="appSecret" v-if="!readOnly">
              <el-input v-model="form.appSecret" placeholder="请输入系统密钥" />
            </el-form-item>
            <el-form-item label="系统密钥：" prop="appSecret" v-if="readOnly" class="custom-form-item">
                {{form.appSecret}}
            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="单点跳转地址" prop="loginUrl" v-if="!readOnly">
              <el-input v-model="form.loginUrl" placeholder="请输入单点跳转地址" />
            </el-form-item>
            <el-form-item label="单点跳转地址：" prop="loginUrl" v-if="readOnly" class="custom-form-item">
                {{form.loginUrl}}
            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="系统图标" prop="iconUrl" v-if="!readOnly">
              <el-input v-model="form.iconUrl" placeholder="请输入系统图标" />
            </el-form-item>
            <el-form-item label="系统图标：" prop="iconUrl" v-if="readOnly" class="custom-form-item">
                {{form.iconUrl}}
            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="展示顺序" prop="showOrder" v-if="!readOnly">
              <el-input v-model="form.showOrder" placeholder="请输入展示顺序" />
            </el-form-item>
            <el-form-item label="展示顺序：" prop="showOrder" v-if="readOnly" class="custom-form-item">
                {{form.showOrder}}
            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="是否展示" prop="isShow" v-if="!readOnly">
              <el-select v-model="form.isShow" size="small" class="query-param">
                <el-option label="是" value="1" />
                <el-option label="否" value="0" />
              </el-select>
            </el-form-item>
            <el-form-item label="是否展示" prop="isShow" v-if="readOnly" class="custom-form-item">
                {{form.isShow}}
            </el-form-item>
        </el-col>
                  </el-row>
              </div>
          </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
          <div v-if="operationType != 3">
              <el-button type="primary" @click="submitForm">确 定</el-button>
              <el-button @click="cancel">取 消</el-button>
          </div>
          <div v-if="operationType == 3">
              <el-button type="primary" @click="cancel">关 闭</el-button>
          </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
    import ssoConfig from "./ssoConfig";
    export default {
        ...ssoConfig
    }
</script>
<style scoped>
    .form-item{
        width: 100%;
    }
</style>
